
<template>
  <div class="containerWrap">
    <div class="headWrap">
      <div class="content_title">奖品管理</div>
      <el-button @click="createPrize()" type="success" style="float: right;margin-right: 20px;">新增一个奖品</el-button>
    </div>
    <div >
      <el-table
        :data="tableData"
        stripe
        style="width: 100%">
        <el-table-column
          prop="id"
          label="奖品ID">
        </el-table-column>
        <el-table-column
          prop="name"
          label="奖品名称">
        </el-table-column>
        <el-table-column
          prop="type"
          label="类型">
        </el-table-column>
        <el-table-column
          prop="address"
          label="库存量">
        </el-table-column>
        <el-table-column
          prop="address"
          label="每次推送数量">
        </el-table-column>
        <el-table-column
          prop="address"
          label="操作">
          <template slot-scope="scope">
            <el-button @click="edit()"  size="small">编辑奖品</el-button>
            <el-button  type="danger" size="small">删除奖品</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--// 编辑或者新增奖品弹框-->
      <el-dialog  title="奖品信息" :visible.sync="prizeVisible" width="30%" >
        <el-form class="demo-form-inline" label-width="100px">
          <el-form-item label="奖品名称">
            <el-input  placeholder="请输入奖品名称，20个字以内"></el-input>
          </el-form-item>
          <el-form-item label="奖品数量">
            <el-input  placeholder="请输入奖品数量"></el-input>
          </el-form-item>
          <el-form-item label="每次推送数量">
            <el-input  placeholder="请输入每次奖品推送数量"></el-input>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="prizeVisible = false">取 消</el-button>
          <el-button type="primary" @click="savePrize">保存奖品信息</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>


<script>
  export default {
    data () {
      return {
//        tableData: [],
        tableData: [{'id': 1}],
        activeName: '0',
        prizeVisible: false,
        prizeTitle: ''
      };
    },
    methods: {
      // 关键字搜索
      searchByWord () {
        alert('关键字搜索');
      },
      // 编辑
      edit () {
        this.prizeVisible = true;
      },
      // 冻结
      freeze () {
        alert('冻结');
      },
      // 删除
//      delete () {
//        alert('删除');
//      },
      // 切换tab页签
      handleClick (tab, event) {
        this.activeName = tab.name;
        alert('切换Tab页签');
      },
      // 保存奖品信息
      savePrize () {
        this.$router.go(-1);
        alert('保存奖品信息');
      },
      // 新增一个奖品
      createPrize () {
        this.prizeVisible = true;
      }
    },
    components: {},
    created: function () {
    }
  };
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
